<template>

	<view class="paypop" :style="{height:windowsHeight+'px'}">
		<u-toast ref="uToast1"></u-toast>
		<view class="payContent">


			<u-cell-group>
				<u-cell title="流水号" :value="orderId"></u-cell>
				<u-cell title="支付金额" :value="rmbtotal"></u-cell>
				<u-cell title="支付方式" value="微信"></u-cell>
			</u-cell-group>
		</view>
		<view class="paybtn">
			<u-button type="primary" text="确认支付" @click="paybtn"></u-button>
		</view>
	</view>

</template>

<script>
	import {
		pay
	} from '@/config/api.js'
	export default {
		data() {
			return {
				rmbtotal: 100,
				orderId: ''
			}
		},
		methods: {
			paybtn() {
				pay(this.orderId).then((res) => {
					this.$refs.uToast1.show({
						type: 'success',
						message: "支付成功",
						duration: "1500",
					})
					setTimeout(() => {
						uni.switchTab({
							url: '/pages/index/index'
						})
					}, 1500)

				})
			},

		},
		
		onLoad(option) {
			console.log(option.order);
			const order = JSON.parse(decodeURIComponent(option.order));

			this.rmbtotal = order.rmbtotal
			this.orderId = order.orderId
			uni.getSystemInfo({
				success: (res) => {
					this.windowsHeight = res.windowHeight
					console.log(res.windowHeight)
				}
			})


		},
	}
</script>

<style lang="scss">
	.paypop {
		width: 100%;

		background-color: #f4f4f4;

		.top {
			width: 100%;
			height: 96rpx;
			line-height: 96rpx;
			text-align: center;
			font-size: 40rpx;
		}

		.payContent {
			width: 95%;
			background-color: white;
			margin: 0 auto;
			border-radius: 20rpx;
		}

		.paybtn {
			width: 95%;
			margin: 20rpx auto 0rpx;
		}
	}
</style>